package com.umgsai.aop.level4;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created by shangyidong on 17/6/29.
 */
public class Main {
    public static void main(String[] args) {
        //创建spring IOC容器
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:spring/applicationContext-level4.xml");
        //从IOC容器中获取bean实例
        ArithmeticCalculator arithmeticCalculator = applicationContext.getBean(ArithmeticCalculator.class);
        int result = arithmeticCalculator.add(4, 6);
        System.out.println(result);
        result = arithmeticCalculator.sub(4, 6);
        System.out.println(result);
        result = arithmeticCalculator.mul(4, 6);
        System.out.println(result);
        result = arithmeticCalculator.div(4, 0);
        System.out.println(result);
    }
}
